package com.jiantong.work.impl.service;

import com.google.common.base.Throwables;
import com.jiantong.work.impl.dao.MarkWearManagementDao;
import com.jiantong.work.model.MarkWearManagement;
import com.jiantong.work.service.MarkWearManagementWriteService;
import io.terminus.boot.rpc.common.annotation.RpcProvider;
import io.terminus.common.model.Response;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * Created by mz03 on 2017/7/20.
 */
@Slf4j
@Service
@RpcProvider
public class MarkWearManagementWriteServiceImpl implements MarkWearManagementWriteService {

    private MarkWearManagementDao markWearManagementDao;

    @Autowired
    public MarkWearManagementWriteServiceImpl(MarkWearManagementDao markWearManagementDao){
        this.markWearManagementDao = markWearManagementDao;
    }
    /**
     * 创建
     *
     * @param markWearManagement 单据对象
     * @return 主键 id
     */
    @Override
    public Response<Boolean> create(MarkWearManagement markWearManagement) {
        try{
            return Response.ok(markWearManagementDao.create(markWearManagement));
        }catch (Exception e){
            log.error("failed to create markWearManagement", Throwables.getStackTraceAsString(e));
            return Response.fail("failed to create markWearManagement");
        }
    }

    /**
     * 更新
     *
     * @param markWearManagement 单据对象
     * @return 主键 id
     */
    @Override
    public Response<Boolean> update(MarkWearManagement markWearManagement) {
        try{
            return Response.ok(markWearManagementDao.update(markWearManagement));
        }catch (Exception e){
            log.error("failed to update markWearManagement", Throwables.getStackTraceAsString(e));
            return Response.fail("failed to update markWearManagement");
        }
    }
}
